import { getUser } from '../service/user'

export const loadUser = async (id: number) => {
  const res = await getUser(id)
  const user = res.data.user
  const name = res.data.user.name
  const userId = res.data.user.id
  const wechat = res.data.user.wechat
  const qq = res.data.user.qq
  const mail = res.data.user.mail
  const phone = res.data.user.phone
  const avatar = `https://avatars.dicebear.com/api/bottts/${res.data.user.name}.svg`
  return {
    user,
    name,
    userId,
    wechat,
    qq,
    mail,
    phone,
    avatar
  }
}
